//
//  SLNewNetMgr.m
//  SoccerLottery
//
//  Created by chuanshuangzhang on 15/12/24.
//  Copyright © 2015年 chuanshuangzhang. All rights reserved.
//

#import "SLNewNetMgr.h"

@implementation SLNewNetMgr

+ (void)getRecommend:(NSString *)type recommendId:(NSString *)recommendId block:(RequestCallBackBlock)block
{
    NSDictionary *param = @{@"ID":recommendId,@"Type":type};
    NSData* jsonData = [NSJSONSerialization dataWithJSONObject:param options:NSJSONWritingPrettyPrinted error:nil];
    NSString* str = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
    NSDictionary *dic = @{@"param":str,@"action":@"GetRecommend"};
    [VWebService getRequestAction:@"GetRecommend"
                         parameter:dic
                     callbackBlock:^(id result, BOOL status, NSError *error) {
                         block(result,status,error);
                     }];
}

+(void)getRecommend:(NSString *)userId type:(NSString *)type pageCount:(NSString *)pageCount pageIndex:(NSString *)pageNum block:(RequestCallBackBlock)block
{
    NSDictionary *param = @{@"UserId":CS(userId),@"pagecount":pageCount,@"pageindex":pageNum,@"Type":type};
    NSData* jsonData = [NSJSONSerialization dataWithJSONObject:param options:NSJSONWritingPrettyPrinted error:nil];
    NSString* str = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
    NSDictionary *dic = @{@"param":str,@"action":@"GetRecommend"};
    [VWebService getRequestAction:@"GetRecommend"
                        parameter:dic
                    callbackBlock:^(id result, BOOL status, NSError *error) {
                        block(result,status,error);
                    }];

}

+(void)setCoins:(NSString *)userId coins:(NSString *)coins recommandId:(NSString *)recommendId block:(RequestCallBackBlock)block
{
    NSDictionary *param = @{@"UserId":userId,@"Points":coins,@"RecommendID":recommendId};
    NSData* jsonData = [NSJSONSerialization dataWithJSONObject:param options:NSJSONWritingPrettyPrinted error:nil];
    NSString* str = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
    NSDictionary *dic = @{@"param":str,@"action":@"SetPoints"};
    [VWebService getRequestAction:@"SetPoints"
                        parameter:dic
                    callbackBlock:^(id result, BOOL status, NSError *error) {
                        block(result,status,error);
                    }];
}

+(void)getPicture:(RequestCallBackBlock)block
{
    NSDictionary *dic = @{@"action":@"GetPicture"};
    [VWebService getRequestAction:@"GetPicture"
                        parameter:dic
                    callbackBlock:^(id result, BOOL status, NSError *error) {
                        block(result,status,error);
                    }];
}

+(void)payCheck:(NSString *)userId receipt:(NSString *)receipt block:(RequestCallBackBlock)block
{
    NSDictionary *param = @{@"userid":userId,@"receipt":receipt};
    NSData* jsonData = [NSJSONSerialization dataWithJSONObject:param options:NSJSONWritingPrettyPrinted error:nil];
    NSString* str = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
    NSDictionary *dic = @{@"param":str,@"action":@"PayCheck"};
    [VWebService getRequestAction:@"PayCheck"
                        parameter:dic
                    callbackBlock:^(id result, BOOL status, NSError *error) {
                        block(result,status,error);
                    }];

}
@end
